/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author 7P7
 */
@Entity
@Table(name = "Student", catalog = "NationalLevelPaperPresentation", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Student.findAll", query = "SELECT s FROM Student s"),
    @NamedQuery(name = "Student.findByStudentID", query = "SELECT s FROM Student s WHERE s.studentID = :studentID"),
    @NamedQuery(name = "Student.findByIsOffCampus", query = "SELECT s FROM Student s WHERE s.isOffCampus = :isOffCampus")})
public class Student implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "StudentID", nullable = false)
    private Integer studentID;
    @Column(name = "IsOff_Campus")
    private Boolean isOffCampus;
    @OneToMany(mappedBy = "studentID")
    private Collection<Prize> prizeCollection;
    @OneToMany(mappedBy = "studentID")
    private Collection<Message> messageCollection;
    @OneToMany(mappedBy = "studentID")
    private Collection<Enrolment> enrolmentCollection;
    @JoinColumn(name = "StudentID", referencedColumnName = "PerID", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Person person;

    public Student() {
    }

    public Student(Integer studentID) {
        this.studentID = studentID;
    }

    public Integer getStudentID() {
        return studentID;
    }

    public void setStudentID(Integer studentID) {
        this.studentID = studentID;
    }

    public Boolean getIsOffCampus() {
        return isOffCampus;
    }

    public void setIsOffCampus(Boolean isOffCampus) {
        this.isOffCampus = isOffCampus;
    }

    @XmlTransient
    public Collection<Prize> getPrizeCollection() {
        return prizeCollection;
    }

    public void setPrizeCollection(Collection<Prize> prizeCollection) {
        this.prizeCollection = prizeCollection;
    }

    @XmlTransient
    public Collection<Message> getMessageCollection() {
        return messageCollection;
    }

    public void setMessageCollection(Collection<Message> messageCollection) {
        this.messageCollection = messageCollection;
    }

    @XmlTransient
    public Collection<Enrolment> getEnrolmentCollection() {
        return enrolmentCollection;
    }

    public void setEnrolmentCollection(Collection<Enrolment> enrolmentCollection) {
        this.enrolmentCollection = enrolmentCollection;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (studentID != null ? studentID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Student)) {
            return false;
        }
        Student other = (Student) object;
        if ((this.studentID == null && other.studentID != null) || (this.studentID != null && !this.studentID.equals(other.studentID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Student[ studentID=" + studentID + " ]";
    }
    
}
